### Project 9 Sound-controlled Light **1.Introduction** Sound sensor is used to detect the intensity of ambient sound; the intensity is proportional to output voltage. In this project, we use graphical programming to read out analog value of sound intensity measuring by sound module, ranging from 0 to 1023. And then map the value to 0-255, displaying on serial monitor. Finally set the mapped value as PwM value to control brightness of LED. **2.Materials Required** 1. KEYESTUDIO UNO Control Board *1 2. V5 Sensor Shield*1 3. Piranha LED*1 4. Sound Module*1 5. Female to Female Dupont Line*6 **3.Connection Diagram** ![](media/image-20251201161551216.png) ![](media/image-20251201161746396.png) **4.Sample Code** ```c int _ABVAR_1_sound_value = 0 ; void setup() { pinMode( 11 , OUTPUT); Serial.begin(9600); } void loop() { _ABVAR_1_sound_value = 0 ; _ABVAR_1_sound_value = ( _ABVAR_1_sound_value + analogRead(0) ) ; analogWrite(11 , map ( _ABVAR_1_sound_value , 0 , 1023 , 0 , 255 ) ); Serial.print("sound val:"); Serial.print(_ABVAR_1_sound_value); Serial.println(); } ``` **5.Result** After downloading program, have a look at values on serial monitor. ![](media/image-20251201161834780.png)